package com.zhoug.router;

import android.content.Context;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Interceptor;
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
import com.alibaba.android.arouter.facade.template.IInterceptor;
import com.zhoug.logging.Logger;

/**
 * @Author HK-LJJ
 * @Date 2019/10/28
 * @Description TODO
 */
@Interceptor(priority = 1)
public class BaseRouterInterceptor implements IInterceptor {
    private static final String TAG = ">>>RouterInterceptor";
    private Context context;

    @Override
    public void process(Postcard postcard, InterceptorCallback callback) {
        //可以拦截登录
       /* if(true){
            callback.onContinue(postcard);
        }else{
            ARouter.getInstance().build("/login/LoginActivity").navigation();
        }*/
        Logger.d(TAG, ":" + postcard.getPath());
        callback.onContinue(postcard);
    }

    @Override
    public void init(Context context) {
        Logger.d(TAG, "init:拦截器");
        this.context = context;
    }

}
